''' Pixels1_functions Traversing a list with a for loop ''' from codex import * from time import sleep import random pix_info = [ [(77, 158, 100), 75, 1], [YELLOW, 50, 1.5], [(203, 182, 6), random.randrange(100), 1], [RED, 50, 2], [random.choice(COLOR_LIST), 100, 1], [YELLOW, 75, 1.5], [BLACK, 0, .05] ] delay = 1 def random_color(): red = random.randrange(256) green = random.randrange(256) blue = random.randrange(256) color = (red, green, blue) turn_pixels(color, 100, 1) def turn_pixels(color, brightness, delay): for pix in range(4): pixels.set(pix, color, brightness) sleep(delay) # === Main program for index in range(len(pix_info)): turn_pixels(pix_info[index][0], pix_info[index][1], pix_info[index][2])